home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / String Mak244058102001.psc / String Maker / frmInput2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-08-07  |  3.6 KB  |  121 lines

  1. VERSION 5.00
  2. Begin VB.Form frmInput2 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "String Input"
  5.    ClientHeight    =   3585
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   6765
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3585
  13.    ScaleWidth      =   6765
  14.    Begin VB.CommandButton Command3 
  15.       Caption         =   "Copy Formated Output"
  16.       Height          =   375
  17.       Left            =   240
  18.       TabIndex        =   4
  19.       Top             =   3120
  20.       Width           =   1935
  21.    End
  22.    Begin VB.CommandButton Command2 
  23.       Caption         =   "Clear"
  24.       Height          =   375
  25.       Left            =   5160
  26.       TabIndex        =   3
  27.       Top             =   3120
  28.       Width           =   1215
  29.    End
  30.    Begin VB.CommandButton Command1 
  31.       Caption         =   "Paste From Clipboard"
  32.       Height          =   375
  33.       Left            =   3120
  34.       TabIndex        =   2
  35.       Top             =   3120
  36.       Width           =   1815
  37.    End
  38.    Begin VB.TextBox txtInput 
  39.       Height          =   2535
  40.       Left            =   240
  41.       MultiLine       =   -1  'True
  42.       ScrollBars      =   3  'Both
  43.       TabIndex        =   1
  44.       Top             =   360
  45.       Width           =   6255
  46.    End
  47.    Begin VB.Frame Frame1 
  48.       Caption         =   "Type the text to be formated here"
  49.       Height          =   2895
  50.       Left            =   120
  51.       TabIndex        =   0
  52.       Top             =   120
  53.       Width           =   6495
  54.    End
  55. Attribute VB_Name = "frmInput2"
  56. Attribute VB_GlobalNameSpace = False
  57. Attribute VB_Creatable = False
  58. Attribute VB_PredeclaredId = True
  59. Attribute VB_Exposed = False
  60. Private Sub Command1_Click()
  61. txtInput.Text = Clipboard.GetText
  62. End Sub
  63. Private Sub Command2_Click()
  64. InputIsDirty = False
  65. txtInput.Text = ""
  66. End Sub
  67. Private Sub Command3_Click()
  68. Clipboard.Clear
  69. Clipboard.SetText frmOutput.txtOutput.Text
  70. End Sub
  71. Private Sub Form_Unload(Cancel As Integer)
  72. QuickFormatOpen = False
  73. frmMain.mnupopformat.Enabled = True
  74. End Sub
  75. Private Sub txtInput_Change()
  76. Dim Comillas As String
  77. Dim CR1 As String
  78. Dim CR2 As String
  79. Dim NewLineVar As String
  80. Dim NewLineSym As String
  81. Dim WorkString As String
  82. Comillas = Chr(34) & " & chr(34) & " & Chr(34)
  83. CR1 = Chr(34) & " & vbNewLine " & vbNewLine
  84. CR2 = Chr(34) & " & vbNewLine _" & vbNewLine
  85. NewLineVar = RecipientVar & " = " & RecipientVar & " & " & Chr(34)
  86. NewLineSym = "& " & Chr(34)
  87. WorkString = ""
  88. If txtInput.Text = "" Then Exit Sub
  89. 'Start string formating
  90. '1.- setting the initial string
  91. If RecipientVar = "" Then RecipientVar = "Var"
  92. WorkString = RecipientVar & " = " & Chr(34)
  93. '2.- Check the string for newlines
  94. For x = 1 To Len(txtInput.Text)
  95. 'Debug.Print Mid(txtInput.Text, x, 1), Asc(Mid(txtInput.Text, x, 1))
  96. Select Case Mid(txtInput.Text, x, 1)
  97.     Case Chr(34)
  98.         WorkString = WorkString & Comillas
  99.         
  100.     Case Chr(13)
  101.         If BrakeSymbol = False Then
  102.         WorkString = WorkString & CR1 & NewLineVar
  103.         Else
  104.         WorkString = WorkString & CR2 & NewLineSym
  105.         End If
  106.     Case Chr(10)
  107.         ' do nothin
  108.         ' Just to get rid of line feed
  109.         
  110.         
  111.     Case Else
  112.         WorkString = WorkString & Mid(txtInput.Text, x, 1)
  113.         
  114. End Select
  115. Next x
  116. '3.- Close the string
  117. WorkString = WorkString & Chr(34)
  118. '4- Update output window
  119. frmOutput.txtOutput.Text = WorkString
  120. End Sub
  121.